!
function(b, a) {
    function h() {
        var a = l.getBoundingClientRect().width;
        540 < a / c && (a = 540 * c);
        a /= 10;
        l.style.fontSize = a + "px";
        m.rem = b.rem = a
    }
    var k, f = b.document,
        l = f.documentElement,
        d = f.querySelector('meta[name="viewport"]'),
        g = f.querySelector('meta[name="flexible"]'),
        c = 0,
        e = 0,
        m = a.flexible || (a.flexible = {});
    if (d) {
        if (a = d.getAttribute("content").match(/initial\-scale=([\d\.]+)/)) e = parseFloat(a[1]), c = parseInt(1 / e)
    } else g && (g = g.getAttribute("content")) && (a = g.match(/initial\-dpr=([\d\.]+)/), g = g.match(/maximum\-dpr=([\d\.]+)/), a && (c = parseFloat(a[1]), e = parseFloat((1 / c).toFixed(2))), g && (c = parseFloat(g[1]), e = parseFloat((1 / c).toFixed(2))));
    c || e || (e = (b.navigator.appVersion.match(/android/gi), b.navigator.appVersion.match(/iphone/gi)), a = b.devicePixelRatio, c = e ? 3 <= a && (!c || 3 <= c) ? 3 : 2 <= a && (!c || 2 <= c) ? 2 : 1 : 1, e = 1 / c);
    l.setAttribute("data-dpr", c);
    d || (d = f.createElement("meta"), d.setAttribute("name", "viewport"), d.setAttribute("content", "initial-scale=" + e + ", maximum-scale=" + e + ", minimum-scale=" + e + ", user-scalable=no"), l.firstElementChild ? l.firstElementChild.appendChild(d) : (e = f.createElement("div"), e.appendChild(d), f.write(e.innerHTML)));
    b.addEventListener("resize", function() {
        clearTimeout(k);
        k = setTimeout(h, 300)
    }, !1);
    b.addEventListener("orientationchange", function() {
        clearTimeout(k);
        k = setTimeout(h, 300)
    }, !1);
    b.addEventListener("pageshow", function(a) {
        a.persisted && (clearTimeout(k), k = setTimeout(h, 300))
    }, !1);
    "complete" === f.readyState ? f.body.style.fontSize = 12 * c + "px" : f.addEventListener("DOMContentLoaded", function() {
        f.body.style.fontSize = 12 * c + "px"
    }, !1);
    h();
    m.dpr = b.dpr = c;
    m.refreshRem = h;
    m.rem2px = function(a) {
        var b = parseFloat(a) * this.rem;
        "string" == typeof a && a.match(/rem$/) && (b += "px");
        return b
    };
    m.px2rem = function(a) {
        var b = parseFloat(a) / this.rem;
        "string" == typeof a && a.match(/px$/) && (b += "rem");
        return b
    }
}(window, window.lib || (window.lib = {}));

setTimeout(function() {
    $("#body-loading").remove();
    $("html").removeClass("noscroll");
}, 1500);


var page1Height = $('.page1').height();
$('.up-arrow').click(function(){
    $("body").animate({scrollTop: page1Height+'px'});
});
$(window).scroll(function(){
    if($(this).scrollTop() >= page1Height ){
        $(".bottom").show();
    }else{
        $(".bottom").hide();
    }
});
$(".receive-btn").click(function(){
    var phone = $(".phone-enter").val();
    var code = $(".code-enter").val();
    if (phone == ""){
        layer.msg('手机号码不能为空');
    }else if(!(/^1[34578]\d{9}$/.test(phone))){
        layer.msg('手机号码有误，请重填');
    }else{
        $(".code").show();
        $(".receive-btn").addClass("goNow")
            $(".goNow").click(function(){
                var coded = $(".code-enter").val();
                if(coded !== ""){
                    $.ajax({
                        type: "post",
                        url: "http://51son.net:8088/api/member/validationCode",
                        data:{
                            mobile: $(".phone-enter").val(),
                            code: $(".code-enter").val(),
                            type: 4
                        },
                        success:function(result){
                            layer.msg(result.message);
                            if(result.success == true){
                                $(".receive-btn").text("领取成功！").attr('disabled',true).addClass("active");
                                $(".phone-enter").attr('disabled',true);
                                $(".code").hide();

                                $(".tips").attr("style", "display:block");
                                if($(".overlayout").length == 0){
                                    $("body").append('<div class="overlayout"></div>');
                                }
                            }
                        },
                        error:function(){
                            layer.msg('请输入正确验证码');
                        }
                    });
                }else{
                    layer.msg('请输入验证码');
                }
            });
    }
});
$(function(){
    if($.cookie("captcha")){
        var count = $.cookie("captcha");
        var btn = $('#getting');
        btn.text(count+'秒后可重新获取').attr('disabled',true).css('cursor','not-allowed');
        var resend = setInterval(function(){
            count--;
            if (count > 0){
                $(".botain-btn").addClass("btn-invalid");
                btn.text(count+'秒后可重新获取').attr('disabled',true).css('cursor','not-allowed');
                $.cookie("captcha", count, {path: '/', expires: (1/86400)*count});
            }else {
                $(".botain-btn").removeClass("btn-invalid");
                clearInterval(resend);
                btn.text("获取验证码").removeClass('disabled').removeAttr('disabled style');
            }
        }, 1000);
    }
    $("#getting").click(function(){
        var phone = $(".phone-enter").val();
        $.ajax({
            type: "post",
            url: "http://51son.net:8088/api/member/sendSmsCode",
            data:{
                mobile: $(".phone-enter").val(),
                type: 4
            },
            success:function(result){
                if (result.success){
                    var btn = $("#getting")
                    var count = 60;
                    var resend = setInterval(function(){
                        count--;
                        if (count > 0){
                            $(".botain-btn").addClass("btn-invalid");
                            btn.text(count+"秒后可重新获取");
                            $.cookie("captcha", count, {path: '/', expires: (1/86400)*count});
                        }else {
                            $(".botain-btn").removeClass("btn-invalid");
                            clearInterval(resend);
                            btn.text("获取验证码").removeAttr('disabled style');
                        }
                    }, 1000);
                    btn.attr('disabled',true).css('cursor','not-allowed');
                }else{
                    layer.msg(result.message);
                } 
            },
            error:function(){
                layer.msg('网络连接异常，请稍后再试');
            }
        });
    });
    $(".phone-enter").bind('input porpertychange',function(){
        if($(".phone-enter").val().length == "11") {
            $(".receive-btn").addClass("active");
        }else{
            $(".receive-btn").removeClass("active");
        }
    });
});

$(".tips-close").click(function() {
    $(".tips").attr("style", "display:none;");
    $(".overlayout").remove();
    $("html").removeClass("noscroll")
});